﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Xml.Serialization;
using CodeAffinity.FormAbstraction;

namespace TestWeb
{
    [Serializable()]
    public class Nizzle : CodeAffinity.FormAbstraction.DataClassBase
    {
        public string FoShizzle { get; set; }

        [PrimaryKeyProperty]
        public string TestDropDown { get; set; }

        static string file;
        string apppath;


        public Nizzle()
        {
            apppath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            file = System.IO.Path.Combine(
                apppath,
                String.Format("DehydratedNizzle{0}.xml", DateTime.Now.ToString("yyyy-MM-ddTHH.mm.ss.fffffff"))
                );
        }

        public override void Update()
        {
            // Create the serializer
            XmlSerializer serializer = new XmlSerializer(typeof(Nizzle));

            // Serialize the object to an XML file
            using (StreamWriter streamWriter = File.CreateText(Nizzle.file))
            {
                serializer.Serialize(streamWriter, this);
            }
        }

        public override void Add()
        {
            Update();
        }
    }
}